package com.resou.reader.mine.vipcenter.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.resou.reader.R;
import com.resou.reader.api.ApiConstant;
import com.resou.reader.api.entry.PrivilegeBean;
import com.resou.reader.assist.WebActivity;
import com.resou.reader.utils.ToastUtil;

import java.util.List;

/***
 * 特权列表的适配器
 */
public class PrivilegeAdapter extends BaseQuickAdapter<PrivilegeBean.PrivilegeDetailBean, BaseViewHolder> {

    public PrivilegeAdapter(int layoutResId, @Nullable List<PrivilegeBean.PrivilegeDetailBean> data) {
        super(layoutResId, data);
    }

    public PrivilegeAdapter(@Nullable List<PrivilegeBean.PrivilegeDetailBean> data) {
        super(data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PrivilegeBean.PrivilegeDetailBean item) {
        Glide.with(mContext).load(item.getPrivilegeUrl() + "").into((ImageView) helper.getView(R.id.ivPic));
        helper.setText(R.id.tvSign, item.getPrivilegeDesc() + "");
        LinearLayout linearLayout = helper.getView(R.id.llSignOnclick);
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                ToastUtil.makeShortToast(item.getPrivilegeDesc() + "");
                WebActivity.startActivity(mContext, ApiConstant.VIPGUIDE, "VIP尊享特权");
//                switch (item.getPrivilegeDesc()) {
//                    case "免费畅读":
//                        break;
//                    case "包外八折":
//                        break;
//                    case "签到特权":
//                        break;
//                    case "身份标识":
//                        break;
//                    case "无广告":
//                        break;
//                    case "生日礼包":
//                        break;
//                }
            }
        });
    }
}
